package jtk.project4.fleet.field;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.FormLayout.Resize;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.ComboField;
import nl.coderight.jazz.form.field.NumberField;
import nl.coderight.jazz.form.field.SelectField;
import nl.coderight.jazz.form.field.TextField;

public class GeneralInformationField extends GroupControl{
	private TextField employeeField;
	private TextField firstNameField;
	private TextField MIField;
	private TextField lastNameField;
	private ComboField<String> statusField;
	private SelectField locationField;
	private SelectField categoryField;
	private SelectField typeField;
	private NumberField laborRateField;
	private NumberField billingRateField;
	
	
	public GeneralInformationField(String bindID){
		setTitle("header.generalinformation");
		setBindID(bindID);
		createFields();
		createLayout();
	}

	private void createFields() {
		// TODO Auto-generated method stub
		employeeField = new TextField("employee", 15);
		//employeeField.setRequired(true);
		
		firstNameField = new TextField("firstname", 15);
		//firstNameField.setRequired(true);
		
		MIField = new TextField("mi", 15);
		
		lastNameField = new TextField("lastname", 15);;
		
		statusField = new ComboField<String>("employees","status");
		
		locationField = new SelectField<String>("employees","location");
		
		categoryField = new SelectField<String>("employees","category");
		
		typeField = new SelectField<String>("employees","type");
		
		laborRateField = new NumberField("laborrate", 15);
		
		billingRateField = new NumberField("billingrate", 15);
	}
	
	private void createLayout() {
		// TODO Auto-generated method stub
		setLayout(new FormLayout())

		.addLabel("label.employee#")		.addField(employeeField)
		.addLabel("label.location")			.addField(locationField, Resize.HORIZONTAL)
		.addRow()
		.addLabel("label.firstname")		.addField(firstNameField)
		.addLabel("label.category")			.addField(categoryField, Resize.HORIZONTAL)
		.addRow()
		.addLabel("label.mi")				.addField(MIField)
		.addLabel("label.type")				.addField(typeField, Resize.HORIZONTAL)
		.addRow()
		.addLabel("label.lastname")			.addField(lastNameField)
		.addLabel("label.laborrate")		.addField(laborRateField)
		.addRow()
		.addLabel("label.status")			.addField(statusField, Resize.HORIZONTAL)
		.addLabel("label.billingrate")		.addField(billingRateField)
		;	
	}
	
}
